package com.java.dp.copy;

import lombok.ToString;

/**
 * @Author lizhilong
 * @create 2019/12/2 15:33
 * @desc
 */
@ToString
public class Student implements Cloneable{

    private String name;

    private Integer age ;

    private Subject subject;

    @Override
    public Object clone() throws CloneNotSupportedException {
        Student student = (Student) super.clone();
        student.subject = (Subject)subject.clone();
        return student;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public void setSubject(Subject subject) {
        this.subject = subject;
    }
}
